﻿using CRM.Admin.Contracts.Contract.Customer;
using KingsSharp.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CRM.Admin.Contracts.Dto.Customer;
using CRM.Admin.Contracts.Model.Customer;
using KingsSharp.Common.Data;
using KingsSharp.Core.Data;
using CRM.Admin.Contracts.Model.Map;

namespace CRM.Admin.Services.Service.Customer
{
    public class SupplyService : ServiceBase, ISupplyService
    {
        private IRepository<SupplyInfo, Guid> supplyRepository;
        public SupplyService(IRepository<SupplyInfo, Guid> _supplyRepository)
            :base(_supplyRepository.UnitOfWork)
        {
            supplyRepository = _supplyRepository;
        }
        public IQueryable<SupplyInfo> Supplys { get { return supplyRepository.Entities; } }
       

        public OperationResult Insert(params SupplyDto[] dtos)
        {
            foreach (var t in dtos)
            {
                t.Id = Guid.NewGuid();
                t.CreateTime = DateTime.Now;
            }
            var result = supplyRepository.Insert(dtos);
            return result;
        }
    }
}
